# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-keyboard
pkgname=('python2-keyboard' 'python-keyboard')
_pkgname=keyboard
pkgver=0.13.5
pkgrel=6
pkgdesc='Hook and simulate keyboard events on Windows and Linux.'
url='https://pypi.org/project/keyboard/#files'
arch=('any')
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.zip")
sha512sums=('e20e2dd8040f8ada62fd2e2aa6cefedadf6359f4ab9752cea8cdb2c21b0a0acd9a563d7e5dbee1b596bff44a8999703999740335911c2da614a1dab065827f71')

prepare() {
  echo '0.13.5' > "$_pkgname-$pkgver/CHANGES.md"

  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-keyboard() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-keyboard() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

